package cn.coisini.api.admin;

import cn.coisini.model.common.dtos.Result;
import cn.coisini.model.common.enums.ResultEnum;
import cn.coisini.model.dto.CarouselDto;
import cn.coisini.model.pojo.Carousel;
import cn.coisini.model.vo.QueryVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xiangshaw
 * Description: 轮播图接口
 */
@Tag(name = "轮播图接口API", description = "轮播图")
@RequestMapping("/api/v1/carousel")
public interface CarouselControllerApi {

    @PreAuthorize("hasAuthority('carousel.add')")
    @Operation(summary = "新增轮播图接口")
    @PostMapping("/add")
    Result<ResultEnum> addCarousel(@RequestBody CarouselDto carouselDto);

    @Operation(summary = "查询轮播图接口")
    @GetMapping("/list")
    Result<Object> getCarouselList(QueryVo queryVo);

    @PreAuthorize("hasAuthority('carousel.remove')")
    @Operation(summary = "删除轮播图接口")
    @DeleteMapping("/remove/{carouselId}")
    Result<ResultEnum> deleteCarousel(@PathVariable("carouselId") String carouselId);

    @PreAuthorize("hasAuthority('carousel.update')")
    @Operation(summary = "更新轮播图接口")
    @PutMapping("/update")
    Result<ResultEnum> updateCarousel(@RequestBody CarouselDto carouselDto);

    @Operation(summary = "根据id查询轮播图接口")
    @GetMapping("/findById/{carouselId}")
    Result<Carousel> getCarousel(@PathVariable("carouselId") String carouselId);

    @PreAuthorize("hasAuthority('carousel.batchRemove')")
    @Operation(summary = "批量删除轮播图接口")
    @DeleteMapping("/batchRemove")
    Result<ResultEnum> batchRemove(@RequestBody List<String> ids);
}
